<? if (!defined("BASEPATH")) exit("No direct script access allowed");

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false );
header("Pragma: no-cache");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title><?=$this->config->item("siteName")?></title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=9" />
		<script type="text/javascript" src="<?=MEDIA?>js/jquery.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>ext-3.4.0/adapter/jquery/ext-jquery-adapter.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>ext-3.4.0/ext-all.js"></script>
		<? /*<script type="text/javascript" src="<?=MEDIA?>ext-3.4.0/src/locale/ext-lang-hu.js"></script> */ ?>
		
		<!-- htmleditor plugins -->
		<? /*
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>js/htmleditor/resources/css/htmleditorplugins.css" />
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.MidasCommand.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.Divider.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.HR.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.Image.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.RemoveFormat.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.IndentOutdent.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.SubSuperScript.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.RemoveFormat.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.FindAndReplace.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.Table.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.Word.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.Link.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.SpecialCharacters.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.UndoRedo.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/htmleditor/src/Ext.ux.form.HtmlEditor.Plugins.js"></script>
		*/ ?>
		
		<script type="text/javascript" src="<?=MEDIA?>js/ckeditor/ckeditor.js"></script>
		
		<script type="text/javascript" src="<?=MEDIA?>js/ProgressBarPager.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/Ext.ux.grid.Search.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/Ext.ux.form.SuperBoxSelect.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/ItemSelector.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/MultiSelect.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/Ext.ux.form.HtmlTableEditor.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/Ext.override.js"></script>

		<script type="text/javascript" src="<?=MEDIA?>js/DataView-more.js"></script>

		<script type="text/javascript" src="<?=MEDIA?>js/treegrid/TreeGridSorter.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/treegrid/TreeGridColumnResizer.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/treegrid/TreeGridNodeUI.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/treegrid/TreeGridLoader.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/treegrid/TreeGridColumns.js"></script>

		<script type="text/javascript" src="<?=MEDIA?>js/treegrid/TreeGrid.js"></script>

		<script type="text/javascript" src="<?=MEDIA?>js/Ext.ux.PasswordMeter.js"></script>

		<script type="text/javascript" src="<?=MEDIA?>js/Ext.ux.ImageCrop.js"></script>
		
		<script type="text/javascript" src="<?=MEDIA?>js/Ext.ux.form.FileUploadField.js"></script>

		<script type="text/javascript">
			<? //include_once(BASEPATH."../media/js/categoryFormElement.js"); ?>
		</script>
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>ext-3.4.0/resources/css/ext-all.css" />
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>css/admin_style.css" />
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>css/superboxselect.css" />
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>css/ItemSelector.css" />

		<!-- start include awesomeuploader plugins -->
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>awesomeuploader/Ext.ux.form.FileUploadField.css" />
		<link rel="stylesheet" type="text/css" href="<?=MEDIA?>awesomeuploader/AwesomeUploader.css" />

		<script type="text/javascript" src="<?=MEDIA?>awesomeuploader/Ext.ux.form.FileUploadField.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>awesomeuploader/Ext.ux.XHRUpload.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>awesomeuploader/swfupload.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>awesomeuploader/swfupload.swfobject.js"></script>
		<script type="text/javascript" src="<?=MEDIA?>awesomeuploader/AwesomeUploader.js"></script>
		<!-- end include awesomeuploader plugins -->

		<script type="text/javascript" src="<?=MEDIA?>js/CheckColumn.js"></script>

		<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=AIzaSyChKlShjLaj3A0thExsw65l_nWUXMe9RE8" type="text/javascript"></script>
		<script src="http://maps.google.com/maps/api/js?sensor=false&amp;language=en&amp;key=AIzaSyChKlShjLaj3A0thExsw65l_nWUXMe9RE8" type="text/javascript"></script>
		<script type="text/javascript" src="<?=MEDIA?>js/Ext.ux.GMapPanel.js"></script>

	</head>
	<body>

<?

	if($this->session->userdata("usrId")) {
?>
		<div id="header" class="x-hide-display">
			<div class="fl w100" style="padding-left:5px;"><br/>
				<h1 class="cp fl" onclick="document.location.href = '<?=base_url()?>';"><?=$this->config->item("siteName")?></h1>
				<? if(Common::isSuperAdmin()) { ?>
				<p class="cp fr" onclick="Ext.Ajax.request({url: '<?=site_url()?>daemonc', success: function() { }});"><img src="<?=MEDIA?>icon/arrow_refresh_big.png" alt="" title="<?=$this->lang->line("PUBLICATION")?>" />&nbsp;&nbsp;&nbsp;&nbsp;</p>
				<? } ?>
				<br class="cb" /><br class="cb" />
				<p><?=$this->lang->line("ENTERED_USER")?>: <?=$this->session->userdata("usrEmail")?></p>
			</div>
		</div>

		<div id="leftMenu"></div>

		<div id="center"></div>

		<script type="text/javascript">

			Ext.onReady(function() {

				Ext.namespace('template');

				Ext.sequence( Ext.form.SliderField.prototype, 'initComponent', function() {
					this.slider.on('change', this.fireEvent.createDelegate( this, 'change', 0 ) );
					this.slider.on('changecomplete', this.fireEvent.createDelegate( this, 'changecomplete', 0 ) );
				});

				/*
				var cp = new Ext.state.CookieProvider({
					expires: new Date(new Date().getTime()+(1000*60*60*24*30)),
				});
				Ext.state.Manager.setProvider(cp);
				*/

				var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$this->db->escape_str($this->lang->line("PLEASE_WAIT,_PROCESSING_IN_PROGRESS"))?>"});
				Ext.Ajax.on('beforerequest', myMask.show, myMask);
				Ext.Ajax.on('requestcomplete', myMask.hide, myMask);
				Ext.Ajax.on('requestexception', myMask.hide, myMask); 

				var centerBox = new Ext.BoxComponent({
					el: 'center'
				});

				var menuTreeGrid = new Ext.ux.tree.TreeGrid({

					id: 'menuTreeGrid',
					border: false,
					autoScroll: true,
					listeners: {
						afterrender: function() {
							Ext.getCmp('menuTreeGrid').getEl().child('div[class=x-grid3-header]').setStyle('display', 'none');
						},
					},

					dataUrl: '<?=site_url()?>admin/getMenu',

					renderTo: 'leftMenu',
					autoExpandColumn: 'label',

					columns:[{
							dataIndex: 'label'
					}],

					bbar: {
						items: [{
							text: '<?=$this->db->escape_str($this->lang->line("LOGOUT"))?>',
							handler: function() {
								Ext.MessageBox.confirm('<?=$this->db->escape_str($this->lang->line("CONFIRMATION"))?>', '<?=$this->db->escape_str($this->lang->line("ARE_YOU_SURE_YOU_WANT_TO_LOG_OUT"))?>?', kilepes);
							},
							icon: '<?=MEDIA?>icon/logout.png'
						}],
						buttonAlign : 'right'
					}

				});

				menuTreeGrid.getSelectionModel().on('selectionchange',function(selModel, node) {

					var e = node.attributes;
					if(!e.url) return false;

					var Tabs = Ext.getCmp('tabs');	//Tabs - tabs object variable
					Tabs.removeAll();
					Tabs.add({
						title: ''
					}).show();
					Tabs.getActiveTab().load({url: '<?=site_url()?>' + e.url + '?<?=mt_rand()?>', scripts:true});
					Tabs.getActiveTab().setTitle(e.title);

				});

				var tabs = new Ext.TabPanel({
					renderTo: 'center',
					id: 'tabs',
					border: false,
					enableTabScroll: true
				});
				tabs.add({
					title: '<?=$this->db->escape_str($this->lang->line("ADMIN"))?>',
					id: 'nyitolap'
				}).show();

				var viewport = new Ext.Viewport({
					layout: 'border',
					hidden: true,
					listeners: {
						afterrender: function(component) {
							component.show();
						}
					},
					items: [
						new Ext.BoxComponent({
							region: 'north',
							height: 75,
							el: 'header',
							autoShow: true
						}), {
							region: 'west',
							split: true,
							//autoScroll: true,
							width: 200,
							minSize: 175,
							maxSize: 400,
							collapsible: true,
							layout: {
								type: 'anchor',
								animate: true
							},
							items: [
								new Ext.BoxComponent({
									el: 'leftMenu'
								})
							],
							autoShow: true
						}, {
						region: 'center',
						id: 'centerRegion',
						autoScroll: true,
						items: 
						centerBox}
					]
				});

				function reload() {
					document.location.reload();
				}

			});

			function kilepes(btn) {
				if(btn == 'yes') {
					document.location = '<?=site_url()?>logout';
				}
			}

		</script>

<?
	}
?>

	<?
		if(isset($content)) echo	$content;
	?>

	</body>
</html>